import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { loadEnv } from 'vite'

import qiankun from 'vite-plugin-qiankun'
export default ({ mode }: any) => {
    const env = loadEnv(mode, process.cwd(), '')

    return defineConfig({
        plugins: [
            vue(),
            qiankun('vue3', {
                useDevMode: true,
            }),
        ],
        base: env.VITE_APP_BASE_URL,
        server: {
            cors: true,
            open: true,
            port: 4100,
            host: '0.0.0.0',
        },
    })
}
